package com.xuecheng.content.controller;

import com.xuecheng.commons.model.dto.BindTeachplanMediaDto;
import com.xuecheng.commons.model.vo.ResponseResult;
import org.springframework.web.bind.annotation.*;
import com.xuecheng.content.service.TeachplanMediaService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author HuangYuwu
 */
@Slf4j
@RestController
public class TeachplanMediaController {

    @Autowired
    private TeachplanMediaService teachplanMediaService;

    /**
     * 课程计划绑定媒资
     *
     * @param bindTeachplanMediaDto
     * @return
     */
    @PostMapping("/teachplan/media/association")
    public ResponseResult bindTeachplanMedia(@RequestBody BindTeachplanMediaDto bindTeachplanMediaDto) {
        return teachplanMediaService.bindTeachplanMedia(bindTeachplanMediaDto);
    }

    /**
     * 删除课程计划的媒资数据
     * @param teachPlanMediaId
     * @return
     */
    @DeleteMapping("/teachplan/media/{teachPlanMediaId}")
    public ResponseResult deleteTeachMedia(@PathVariable Long teachPlanMediaId) {
        return teachplanMediaService.deleteTeachMedia(teachPlanMediaId);
    }

}
